import 'dart:convert';

VideoEntity videoEntityFromJson(String str) => VideoEntity.fromJson(json.decode(str));

String videoEntityToJson(VideoEntity data) => json.encode(data.toJson());

class VideoEntity {
  int total;
  List<ListVideoElement> list;
  int current;

  VideoEntity({
    required this.total,
    required this.list,
    required this.current,
  });

  factory VideoEntity.fromJson(Map<String, dynamic> json) => VideoEntity(
    total: json["total"],
    list: List<ListVideoElement>.from(json["list"].map((x) => ListVideoElement.fromJson(x))),
    current: json["current"],
  );

  Map<String, dynamic> toJson() => {
    "total": total,
    "list": List<dynamic>.from(list.map((x) => x.toJson())),
    "current": current,
  };
}

class ListVideoElement {
  int? id;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic deletedAt;
  String? listClass;
  int? typeId;
  String? title;
  String? content;
  String? fileVideo;
  int? status;
  int? viewNum;
  String? imghead;

  ListVideoElement({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.deletedAt,
    required this.listClass,
    required this.typeId,
    required this.title,
    required this.content,
    required this.fileVideo,
    required this.status,
    required this.viewNum,
    required this.imghead,
  });

  factory ListVideoElement.fromJson(Map<String, dynamic> json) => ListVideoElement(
    id: json["id"],
    createdAt: DateTime.parse(json["created_at"]),
    updatedAt: DateTime.parse(json["updated_at"]),
    deletedAt: json["deleted_at"],
    listClass: json["class"],
    typeId: json["type_id"],
    title: json["title"],
    content: json["content"],
    fileVideo: json["file_video"],
    status: json["status"],
    viewNum: json["view_num"],
    imghead: json["img_head"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "created_at": createdAt?.toIso8601String(),
    "updated_at": updatedAt?.toIso8601String(),
    "deleted_at": deletedAt,
    "class": listClass,
    "type_id": typeId,
    "title": title,
    "content": content,
    "file_video": fileVideo,
    "status": status,
    "view_num": viewNum,
    "img_head": imghead,
  };
}
